<?php
$table = "user";
$query = mysql_query("select count(nid) from $table");
$dapartSum = mysql_result($query, 0);
$result = mysql_query("select * from $table order by user_id");
while ($row = mysql_fetch_array($result)) {
    $admin_department[] = $row['department'];
	$admin_user_name[] = $row['user_name'];
}

$departmentArray = array();
foreach($admin_department as $one){
    $departmentArray[$one] = true; // 剔除数组中重复的部门
}
$departmentStr = array_keys($departmentArray);

?>